﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WFcontrol
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

       

        private void textBox1_TextChanged_1(object sender, EventArgs e)
        {
            string text;
            text = ((TextBox)sender).Text;
            ((TextBox)sender).Text = text.ToUpper();
        }



        private void button1_Click(object sender, EventArgs e)
        {
            this.Dispose();
        }

        private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!char.IsDigit(e.KeyChar))
                e.Handled = true;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            if (listBox1.Items.IndexOf(textBox1.Text)>=0)
                listBox1.SelectedItem = textBox1.Text;
            else if (textBox1.Text.Length > 0)
                listBox1.Items.Add(textBox1.Text);
            textBox1.Text = null;
        }

        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listBox1.SelectedIndex >= 0)
                listBox1.Items.RemoveAt(listBox1.SelectedIndex);
        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            string str;
            str = comboBox1.Items[comboBox1.SelectedIndex].ToString();
            MessageBox.Show(str);
        }

       
    }
}
